package com.example.shop.persistence.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 用户收货地址表
 * </p>
 *
 * @author jason
 * @since 2019-12-17
 */
@TableName("shop_user_address")
public class UserAddress extends Model<UserAddress> {

    private static final long serialVersionUID=1L;

    @ApiModelProperty(value="id",name="id",example = "1", hidden=true)
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 用户ID
     */
    @TableField("userID")
    private Integer userID;

    /**
     * 联系人
     */
    @ApiModelProperty("联系人")
    private String consignee;

    /**
     * 联系电话
     */
    private String tel;

    /**
     * 地址
     */
    private String address;

    /**
     * 地区编码，通过省市区选择获取
     */
    @ApiModelProperty("地区编码，通过省市区选择获取")
    @TableField("areaCode")
    private Integer areaCode;

    /**
     * 邮政编码
     */
    @ApiModelProperty("邮政编码")
    @TableField("postalCode")
    private Integer postalCode;

    /**
     * 是否为默认地址  0否 1是
     */
    @ApiModelProperty("是否为默认收货地址 0否 1是")
    private Integer isDefault;

    /**
     * 创建/更新时间
     */
    @TableField("updateTime")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    private LocalDateTime updateTime;


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getUserID() {
        return userID;
    }

    public void setUserID(Integer userID) {
        this.userID = userID;
    }

    public String getConsignee() {
        return consignee;
    }

    public void setConsignee(String consignee) {
        this.consignee = consignee;
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Integer getAreaCode() {
        return areaCode;
    }

    public void setAreaCode(Integer areaCode) {
        this.areaCode = areaCode;
    }

    public Integer getPostalCode() {
        return postalCode;
    }

    public void setPostalCode(Integer postalCode) {
        this.postalCode = postalCode;
    }

    public Integer getIsDefault() {
        return isDefault;
    }

    public void setIsDefault(Integer isDefault) {
        this.isDefault = isDefault;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "UserAddress{" +
        "id=" + id +
        ", userID=" + userID +
        ", consignee=" + consignee +
        ", tel=" + tel +
        ", address=" + address +
        ", areaCode=" + areaCode +
        ", postalCode=" + postalCode +
        ", isDefault=" + isDefault +
        ", updateTime=" + updateTime +
        "}";
    }
}
